package kusterordonio.interfaz;

import java.awt.event.KeyEvent;
import java.util.*;
import java.text.*;

import javax.swing.JOptionPane;
import kusterordonio.dominio.*;

public class VentanaCalendario extends javax.swing.JFrame {
    
    private SistemaCarne modelo;
    private Ninio niño;

    /** Creates new form VentanaCalendario */
    public VentanaCalendario() {
        initComponents();
    }
    
    public VentanaCalendario(SistemaCarne unSistema, Ninio unNiño) {
        modelo = unSistema;
        niño = unNiño;
        initComponents();
        cargarDatos();
        controlGenero();
        cargarFechas();
        jBtnSalir.setMnemonic(KeyEvent.VK_S);
        jBtnConfirmar.setMnemonic(KeyEvent.VK_C);
        jDateFecha1.setMinSelectableDate(niño.getFechaNac());
        jDateFecha2.setMinSelectableDate(niño.getFechaNac());
    }

    @SuppressWarnings("unchecked")
    
    public void controlGenero(){
        if (!niño.isSexo()){
            jLabelTitular.setForeground(new java.awt.Color(255, 153, 0));
            jLabel1.setForeground(new java.awt.Color(255, 153, 0));
            jLabel2.setForeground(new java.awt.Color(255, 153, 0));
            jLabel3.setForeground(new java.awt.Color(255, 153, 0));
            jTextField1.setBackground(new java.awt.Color(255, 153, 0));
            jTextField2.setBackground(new java.awt.Color(255, 153, 0));
            jTextField3.setBackground(new java.awt.Color(255, 153, 0));
            jTextField4.setBackground(new java.awt.Color(255, 153, 0));
            jTextField5.setBackground(new java.awt.Color(255, 153, 0));
            jTextField6.setBackground(new java.awt.Color(255, 153, 0));
            jTextField7.setBackground(new java.awt.Color(255, 153, 0));
            jTextField8.setBackground(new java.awt.Color(255, 153, 0));
            jTextField11.setBackground(new java.awt.Color(255, 153, 0));
            jTextField12.setBackground(new java.awt.Color(255, 153, 0));
            jTextField13.setBackground(new java.awt.Color(255, 153, 0));
            jTextField14.setBackground(new java.awt.Color(255, 153, 0));
            jTextField15.setBackground(new java.awt.Color(255, 153, 0));
            jTextField16.setBackground(new java.awt.Color(255, 153, 0));
            jTextField17.setBackground(new java.awt.Color(255, 153, 0));
            jTMes1.setBackground(new java.awt.Color(255, 153, 0));
            jTMes2.setBackground(new java.awt.Color(255, 153, 0));
            jTMes3.setBackground(new java.awt.Color(255, 153, 0));
            jTMes4.setBackground(new java.awt.Color(255, 153, 0));
            jTMes5.setBackground(new java.awt.Color(255, 153, 0));
            jTMes6.setBackground(new java.awt.Color(255, 153, 0));
            jTMes7.setBackground(new java.awt.Color(255, 153, 0));
            jTMes8.setBackground(new java.awt.Color(255, 153, 0));
            jTMes9.setBackground(new java.awt.Color(255, 153, 0));
            jTMes10.setBackground(new java.awt.Color(255, 153, 0));
            jTMes11.setBackground(new java.awt.Color(255, 153, 0));
            jTMes12.setBackground(new java.awt.Color(255, 153, 0));
        }
    }
    
    public void cargarFechas(){
        
        if(niño.getCarne().getRecienNacido().getPrimerControl() != null){
            SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy");
            this.jLabelFecha1.setText(formato.format(niño.getCarne().getRecienNacido().getPrimerControl()));
            this.jDateFecha1.setEnabled(false);
            this.jDateFecha1.setVisible(false);
        }
        if(niño.getCarne().getRecienNacido().getSegundoControl() != null){
            SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy");
            this.jLabelFecha2.setText(formato.format(niño.getCarne().getRecienNacido().getSegundoControl()));
            this.jDateFecha2.setEnabled(false);
            this.jDateFecha2.setVisible(false);
        }
        if(niño.getCarne().getRecienNacido().getPrimerControl()!=null && niño.getCarne().getRecienNacido().getSegundoControl()!=null){
            this.jBtnConfirmar.setVisible(false);
        }
    }
    public void cargarDatos(){
        jLabelNombre.setText(niño.toString());
    }
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel2 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jTextField2 = new javax.swing.JTextField();
        jTextField3 = new javax.swing.JTextField();
        jTextField7 = new javax.swing.JTextField();
        jTextField8 = new javax.swing.JTextField();
        jLabelTick25 = new javax.swing.JLabel();
        jLabelTick26 = new javax.swing.JLabel();
        jDateFecha1 = new com.toedter.calendar.JDateChooser();
        jDateFecha2 = new com.toedter.calendar.JDateChooser();
        jLabelFecha1 = new javax.swing.JLabel();
        jLabelFecha2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jTextField4 = new javax.swing.JTextField();
        jTextField5 = new javax.swing.JTextField();
        jTextField6 = new javax.swing.JTextField();
        jTMes1 = new javax.swing.JTextField();
        jTMes2 = new javax.swing.JTextField();
        jTMes3 = new javax.swing.JTextField();
        jTMes4 = new javax.swing.JTextField();
        jTMes5 = new javax.swing.JTextField();
        jTMes6 = new javax.swing.JTextField();
        jTMes7 = new javax.swing.JTextField();
        jTMes8 = new javax.swing.JTextField();
        jTMes9 = new javax.swing.JTextField();
        jTMes10 = new javax.swing.JTextField();
        jTMes11 = new javax.swing.JTextField();
        jTMes12 = new javax.swing.JTextField();
        jLabelTick1 = new javax.swing.JLabel();
        jLabelTick2 = new javax.swing.JLabel();
        jLabelTick3 = new javax.swing.JLabel();
        jLabelTick4 = new javax.swing.JLabel();
        jLabelTick5 = new javax.swing.JLabel();
        jLabelTick6 = new javax.swing.JLabel();
        jLabelTick7 = new javax.swing.JLabel();
        jLabelTick8 = new javax.swing.JLabel();
        jLabelTick9 = new javax.swing.JLabel();
        jLabelTick10 = new javax.swing.JLabel();
        jLabelTick11 = new javax.swing.JLabel();
        jLabelTick12 = new javax.swing.JLabel();
        jLabelTick13 = new javax.swing.JLabel();
        jLabelTick14 = new javax.swing.JLabel();
        jLabelTick15 = new javax.swing.JLabel();
        jLabelTick16 = new javax.swing.JLabel();
        jLabelTick17 = new javax.swing.JLabel();
        jLabelTick18 = new javax.swing.JLabel();
        jLabelTick19 = new javax.swing.JLabel();
        jLabelTick20 = new javax.swing.JLabel();
        jLabelTick21 = new javax.swing.JLabel();
        jLabelTick22 = new javax.swing.JLabel();
        jLabelTick23 = new javax.swing.JLabel();
        jLabelTick24 = new javax.swing.JLabel();
        jTextField11 = new javax.swing.JTextField();
        jTextField12 = new javax.swing.JTextField();
        jTextField13 = new javax.swing.JTextField();
        jTextField14 = new javax.swing.JTextField();
        jTextField15 = new javax.swing.JTextField();
        jTextField16 = new javax.swing.JTextField();
        jTextField17 = new javax.swing.JTextField();
        jTextField18 = new javax.swing.JTextField();
        jTextField19 = new javax.swing.JTextField();
        jTextField20 = new javax.swing.JTextField();
        jTextField21 = new javax.swing.JTextField();
        jTextField22 = new javax.swing.JTextField();
        jTextField23 = new javax.swing.JTextField();
        jTextField24 = new javax.swing.JTextField();
        jTextField25 = new javax.swing.JTextField();
        jBtnSalir = new javax.swing.JButton();
        jBtnConfirmar = new javax.swing.JButton();
        jLabelTitular = new javax.swing.JLabel();
        jLabelNombre = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Calendario de controles");
        setBounds(new java.awt.Rectangle(200, 100, 0, 0));
        setResizable(false);

        jPanel1.setLayout(null);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabel1.setForeground(new java.awt.Color(51, 153, 0));
        jLabel1.setText("Calendario de controles periódicos");
        jPanel1.add(jLabel1);
        jLabel1.setBounds(20, 20, 350, 20);
        jPanel1.add(jSeparator1);
        jSeparator1.setBounds(0, 50, 640, 10);

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(51, 153, 0));
        jLabel2.setText("Del recién nacido");
        jPanel1.add(jLabel2);
        jLabel2.setBounds(30, 70, 170, 20);

        jTextField1.setBackground(new java.awt.Color(51, 153, 0));
        jTextField1.setEditable(false);
        jTextField1.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField1.setForeground(new java.awt.Color(255, 255, 255));
        jTextField1.setText("Días de vida ");
        jPanel1.add(jTextField1);
        jTextField1.setBounds(40, 100, 140, 20);

        jTextField2.setBackground(new java.awt.Color(51, 153, 0));
        jTextField2.setEditable(false);
        jTextField2.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField2.setForeground(new java.awt.Color(255, 255, 255));
        jTextField2.setText("Frecuencia de controles");
        jPanel1.add(jTextField2);
        jTextField2.setBounds(40, 120, 140, 20);

        jTextField3.setBackground(new java.awt.Color(51, 153, 0));
        jTextField3.setEditable(false);
        jTextField3.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField3.setForeground(new java.awt.Color(255, 255, 255));
        jTextField3.setText("Recuerde la fecha");
        jPanel1.add(jTextField3);
        jTextField3.setBounds(40, 140, 140, 20);

        jTextField7.setBackground(new java.awt.Color(51, 153, 0));
        jTextField7.setEditable(false);
        jTextField7.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField7.setForeground(new java.awt.Color(255, 255, 255));
        jTextField7.setText("6º - 9º");
        jPanel1.add(jTextField7);
        jTextField7.setBounds(180, 100, 170, 20);

        jTextField8.setBackground(new java.awt.Color(51, 153, 0));
        jTextField8.setEditable(false);
        jTextField8.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField8.setForeground(new java.awt.Color(255, 255, 255));
        jTextField8.setText("20 - 23");
        jPanel1.add(jTextField8);
        jTextField8.setBounds(350, 100, 170, 20);

        jLabelTick25.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kusterordonio/recursos/tickN.gif"))); // NOI18N
        jLabelTick25.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick25);
        jLabelTick25.setBounds(180, 120, 170, 20);

        jLabelTick26.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kusterordonio/recursos/tickN.gif"))); // NOI18N
        jLabelTick26.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick26);
        jLabelTick26.setBounds(350, 120, 170, 20);

        jDateFecha1.setDateFormatString("dd/MM/yyyy");
        jPanel1.add(jDateFecha1);
        jDateFecha1.setBounds(180, 140, 170, 20);

        jDateFecha2.setDateFormatString("dd/MM/yyyy");
        jPanel1.add(jDateFecha2);
        jDateFecha2.setBounds(350, 140, 170, 20);

        jLabelFecha1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelFecha1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel1.add(jLabelFecha1);
        jLabelFecha1.setBounds(180, 140, 170, 20);

        jLabelFecha2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelFecha2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel1.add(jLabelFecha2);
        jLabelFecha2.setBounds(350, 140, 170, 20);

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(51, 153, 0));
        jLabel3.setText("Del primer mes al año de vida");
        jPanel1.add(jLabel3);
        jLabel3.setBounds(30, 190, 240, 20);

        jTextField4.setBackground(new java.awt.Color(51, 153, 0));
        jTextField4.setEditable(false);
        jTextField4.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField4.setForeground(new java.awt.Color(255, 255, 255));
        jTextField4.setText("Meses de vida");
        jPanel1.add(jTextField4);
        jTextField4.setBounds(40, 220, 140, 20);

        jTextField5.setBackground(new java.awt.Color(51, 153, 0));
        jTextField5.setEditable(false);
        jTextField5.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField5.setForeground(new java.awt.Color(255, 255, 255));
        jTextField5.setText("Control pediátrico");
        jPanel1.add(jTextField5);
        jTextField5.setBounds(40, 240, 140, 20);

        jTextField6.setBackground(new java.awt.Color(51, 153, 0));
        jTextField6.setEditable(false);
        jTextField6.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField6.setForeground(new java.awt.Color(255, 255, 255));
        jTextField6.setText("Control odontológico");
        jPanel1.add(jTextField6);
        jTextField6.setBounds(40, 260, 140, 20);

        jTMes1.setBackground(new java.awt.Color(51, 153, 0));
        jTMes1.setEditable(false);
        jTMes1.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTMes1.setForeground(new java.awt.Color(255, 255, 255));
        jTMes1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTMes1.setText("1");
        jPanel1.add(jTMes1);
        jTMes1.setBounds(180, 220, 20, 20);

        jTMes2.setBackground(new java.awt.Color(51, 153, 0));
        jTMes2.setEditable(false);
        jTMes2.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTMes2.setForeground(new java.awt.Color(255, 255, 255));
        jTMes2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTMes2.setText("2");
        jPanel1.add(jTMes2);
        jTMes2.setBounds(200, 220, 20, 20);

        jTMes3.setBackground(new java.awt.Color(51, 153, 0));
        jTMes3.setEditable(false);
        jTMes3.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTMes3.setForeground(new java.awt.Color(255, 255, 255));
        jTMes3.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTMes3.setText("3");
        jPanel1.add(jTMes3);
        jTMes3.setBounds(220, 220, 20, 20);

        jTMes4.setBackground(new java.awt.Color(51, 153, 0));
        jTMes4.setEditable(false);
        jTMes4.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTMes4.setForeground(new java.awt.Color(255, 255, 255));
        jTMes4.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTMes4.setText("4");
        jPanel1.add(jTMes4);
        jTMes4.setBounds(240, 220, 20, 20);

        jTMes5.setBackground(new java.awt.Color(51, 153, 0));
        jTMes5.setEditable(false);
        jTMes5.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTMes5.setForeground(new java.awt.Color(255, 255, 255));
        jTMes5.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTMes5.setText("5");
        jPanel1.add(jTMes5);
        jTMes5.setBounds(260, 220, 20, 20);

        jTMes6.setBackground(new java.awt.Color(51, 153, 0));
        jTMes6.setEditable(false);
        jTMes6.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTMes6.setForeground(new java.awt.Color(255, 255, 255));
        jTMes6.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTMes6.setText("6");
        jPanel1.add(jTMes6);
        jTMes6.setBounds(280, 220, 20, 20);

        jTMes7.setBackground(new java.awt.Color(51, 153, 0));
        jTMes7.setEditable(false);
        jTMes7.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTMes7.setForeground(new java.awt.Color(255, 255, 255));
        jTMes7.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTMes7.setText("7");
        jPanel1.add(jTMes7);
        jTMes7.setBounds(300, 220, 20, 20);

        jTMes8.setBackground(new java.awt.Color(51, 153, 0));
        jTMes8.setEditable(false);
        jTMes8.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTMes8.setForeground(new java.awt.Color(255, 255, 255));
        jTMes8.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTMes8.setText("8");
        jPanel1.add(jTMes8);
        jTMes8.setBounds(320, 220, 20, 20);

        jTMes9.setBackground(new java.awt.Color(51, 153, 0));
        jTMes9.setEditable(false);
        jTMes9.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTMes9.setForeground(new java.awt.Color(255, 255, 255));
        jTMes9.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTMes9.setText("9");
        jPanel1.add(jTMes9);
        jTMes9.setBounds(340, 220, 20, 20);

        jTMes10.setBackground(new java.awt.Color(51, 153, 0));
        jTMes10.setEditable(false);
        jTMes10.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTMes10.setForeground(new java.awt.Color(255, 255, 255));
        jTMes10.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTMes10.setText("10");
        jPanel1.add(jTMes10);
        jTMes10.setBounds(360, 220, 20, 20);

        jTMes11.setBackground(new java.awt.Color(51, 153, 0));
        jTMes11.setEditable(false);
        jTMes11.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTMes11.setForeground(new java.awt.Color(255, 255, 255));
        jTMes11.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTMes11.setText("11");
        jPanel1.add(jTMes11);
        jTMes11.setBounds(380, 220, 20, 20);

        jTMes12.setBackground(new java.awt.Color(51, 153, 0));
        jTMes12.setEditable(false);
        jTMes12.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTMes12.setForeground(new java.awt.Color(255, 255, 255));
        jTMes12.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTMes12.setText("12");
        jPanel1.add(jTMes12);
        jTMes12.setBounds(400, 220, 20, 20);

        jLabelTick1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kusterordonio/recursos/tickN.gif"))); // NOI18N
        jLabelTick1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick1);
        jLabelTick1.setBounds(180, 240, 20, 20);

        jLabelTick2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kusterordonio/recursos/tickN.gif"))); // NOI18N
        jLabelTick2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick2);
        jLabelTick2.setBounds(200, 240, 20, 20);

        jLabelTick3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kusterordonio/recursos/tickN.gif"))); // NOI18N
        jLabelTick3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick3);
        jLabelTick3.setBounds(220, 240, 20, 20);

        jLabelTick4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kusterordonio/recursos/tickN.gif"))); // NOI18N
        jLabelTick4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick4);
        jLabelTick4.setBounds(240, 240, 20, 20);

        jLabelTick5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kusterordonio/recursos/tickN.gif"))); // NOI18N
        jLabelTick5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick5);
        jLabelTick5.setBounds(260, 240, 20, 20);

        jLabelTick6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kusterordonio/recursos/tickN.gif"))); // NOI18N
        jLabelTick6.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick6);
        jLabelTick6.setBounds(280, 240, 20, 20);

        jLabelTick7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick7.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick7);
        jLabelTick7.setBounds(300, 240, 20, 20);

        jLabelTick8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kusterordonio/recursos/tickN.gif"))); // NOI18N
        jLabelTick8.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick8);
        jLabelTick8.setBounds(320, 240, 20, 20);

        jLabelTick9.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick9.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick9);
        jLabelTick9.setBounds(340, 240, 20, 20);

        jLabelTick10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kusterordonio/recursos/tickN.gif"))); // NOI18N
        jLabelTick10.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick10);
        jLabelTick10.setBounds(360, 240, 20, 20);

        jLabelTick11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick11.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick11);
        jLabelTick11.setBounds(380, 240, 20, 20);

        jLabelTick12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kusterordonio/recursos/tickN.gif"))); // NOI18N
        jLabelTick12.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick12);
        jLabelTick12.setBounds(400, 240, 20, 20);

        jLabelTick13.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick13.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick13);
        jLabelTick13.setBounds(180, 260, 20, 20);

        jLabelTick14.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick14.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick14);
        jLabelTick14.setBounds(200, 260, 20, 20);

        jLabelTick15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick15.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick15);
        jLabelTick15.setBounds(220, 260, 20, 20);

        jLabelTick16.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick16.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick16);
        jLabelTick16.setBounds(240, 260, 20, 20);

        jLabelTick17.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick17.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick17);
        jLabelTick17.setBounds(260, 260, 20, 20);

        jLabelTick18.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kusterordonio/recursos/tickN.gif"))); // NOI18N
        jLabelTick18.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick18);
        jLabelTick18.setBounds(280, 260, 20, 20);

        jLabelTick19.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick19.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick19);
        jLabelTick19.setBounds(300, 260, 20, 20);

        jLabelTick20.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick20.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick20);
        jLabelTick20.setBounds(320, 260, 20, 20);

        jLabelTick21.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick21.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick21);
        jLabelTick21.setBounds(340, 260, 20, 20);

        jLabelTick22.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick22.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick22);
        jLabelTick22.setBounds(360, 260, 20, 20);

        jLabelTick23.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick23.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick23);
        jLabelTick23.setBounds(380, 260, 20, 20);

        jLabelTick24.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTick24.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kusterordonio/recursos/tickN.gif"))); // NOI18N
        jLabelTick24.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(176, 191, 132)));
        jPanel1.add(jLabelTick24);
        jLabelTick24.setBounds(400, 260, 20, 20);

        jTextField11.setBackground(new java.awt.Color(51, 153, 0));
        jTextField11.setEditable(false);
        jTextField11.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField11.setForeground(new java.awt.Color(255, 255, 255));
        jTextField11.setText("Meses de vida");
        jPanel1.add(jTextField11);
        jTextField11.setBounds(40, 300, 140, 20);

        jTextField12.setBackground(new java.awt.Color(51, 153, 0));
        jTextField12.setEditable(false);
        jTextField12.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField12.setForeground(new java.awt.Color(255, 255, 255));
        jTextField12.setText("Control pediátrico");
        jPanel1.add(jTextField12);
        jTextField12.setBounds(40, 320, 140, 20);

        jTextField13.setBackground(new java.awt.Color(51, 153, 0));
        jTextField13.setEditable(false);
        jTextField13.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField13.setForeground(new java.awt.Color(255, 255, 255));
        jTextField13.setText("Control odontológico");
        jPanel1.add(jTextField13);
        jTextField13.setBounds(40, 340, 140, 20);

        jTextField14.setBackground(new java.awt.Color(51, 153, 0));
        jTextField14.setEditable(false);
        jTextField14.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField14.setForeground(new java.awt.Color(255, 255, 255));
        jTextField14.setText("1 a 2");
        jPanel1.add(jTextField14);
        jTextField14.setBounds(180, 300, 80, 20);

        jTextField15.setBackground(new java.awt.Color(51, 153, 0));
        jTextField15.setEditable(false);
        jTextField15.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField15.setForeground(new java.awt.Color(255, 255, 255));
        jTextField15.setText("2 a 3");
        jPanel1.add(jTextField15);
        jTextField15.setBounds(260, 300, 80, 20);

        jTextField16.setBackground(new java.awt.Color(51, 153, 0));
        jTextField16.setEditable(false);
        jTextField16.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField16.setForeground(new java.awt.Color(255, 255, 255));
        jTextField16.setText("4 años");
        jPanel1.add(jTextField16);
        jTextField16.setBounds(340, 300, 80, 20);

        jTextField17.setBackground(new java.awt.Color(51, 153, 0));
        jTextField17.setEditable(false);
        jTextField17.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTextField17.setForeground(new java.awt.Color(255, 255, 255));
        jTextField17.setText("a partir de los 5 años");
        jPanel1.add(jTextField17);
        jTextField17.setBounds(420, 300, 130, 20);

        jTextField18.setEditable(false);
        jTextField18.setFont(new java.awt.Font("Tahoma", 0, 9));
        jTextField18.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextField18.setText("cada 3 meses");
        jPanel1.add(jTextField18);
        jTextField18.setBounds(180, 320, 80, 20);

        jTextField19.setEditable(false);
        jTextField19.setFont(new java.awt.Font("Tahoma", 0, 9));
        jTextField19.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextField19.setText("cada 4 meses");
        jPanel1.add(jTextField19);
        jTextField19.setBounds(260, 320, 80, 20);

        jTextField20.setEditable(false);
        jTextField20.setFont(new java.awt.Font("Tahoma", 0, 9));
        jTextField20.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextField20.setText("cada 6 meses");
        jPanel1.add(jTextField20);
        jTextField20.setBounds(340, 320, 80, 20);

        jTextField21.setEditable(false);
        jTextField21.setFont(new java.awt.Font("Tahoma", 0, 9));
        jTextField21.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextField21.setText("anual");
        jPanel1.add(jTextField21);
        jTextField21.setBounds(420, 320, 130, 20);

        jTextField22.setEditable(false);
        jTextField22.setFont(new java.awt.Font("Tahoma", 0, 9));
        jTextField22.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextField22.setText("cada 6 meses");
        jPanel1.add(jTextField22);
        jTextField22.setBounds(180, 340, 80, 20);

        jTextField23.setEditable(false);
        jTextField23.setFont(new java.awt.Font("Tahoma", 0, 9));
        jTextField23.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextField23.setText("cada 6 meses");
        jPanel1.add(jTextField23);
        jTextField23.setBounds(260, 340, 80, 20);

        jTextField24.setEditable(false);
        jTextField24.setFont(new java.awt.Font("Tahoma", 0, 9));
        jTextField24.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextField24.setText("anual");
        jPanel1.add(jTextField24);
        jTextField24.setBounds(340, 340, 80, 20);

        jTextField25.setEditable(false);
        jTextField25.setFont(new java.awt.Font("Tahoma", 0, 9));
        jTextField25.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTextField25.setText("anual");
        jPanel1.add(jTextField25);
        jTextField25.setBounds(420, 340, 130, 20);

        jBtnSalir.setText("Salir");
        jBtnSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnSalirActionPerformed(evt);
            }
        });
        jPanel1.add(jBtnSalir);
        jBtnSalir.setBounds(260, 380, 80, 22);

        jBtnConfirmar.setText("Confirmar");
        jBtnConfirmar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBtnConfirmarActionPerformed(evt);
            }
        });
        jPanel1.add(jBtnConfirmar);
        jBtnConfirmar.setBounds(530, 140, 80, 22);

        jLabelTitular.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabelTitular.setForeground(new java.awt.Color(51, 153, 0));
        jLabelTitular.setText("Titular:");
        jPanel1.add(jLabelTitular);
        jLabelTitular.setBounds(400, 25, 50, 20);

        jLabelNombre.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabelNombre.setForeground(new java.awt.Color(51, 51, 51));
        jPanel1.add(jLabelNombre);
        jLabelNombre.setBounds(460, 25, 220, 20);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 639, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jBtnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnSalirActionPerformed
        this.dispose();
    }//GEN-LAST:event_jBtnSalirActionPerformed

private void jBtnConfirmarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnConfirmarActionPerformed
    modelo.calculoDiasEntreFechas(this.jDateFecha1.getDate(), niño.getFechaNac());
    if(this.jDateFecha1.getDate() != null
            && modelo.calculoDiasEntreFechas(this.jDateFecha1.getDate(), niño.getFechaNac())>=6
            && modelo.calculoDiasEntreFechas(this.jDateFecha1.getDate(), niño.getFechaNac())<=9){
        niño.getCarne().getRecienNacido().setPrimerControl(jDateFecha1.getDate());
    }
    if(this.jDateFecha2.getDate() != null
            && modelo.calculoDiasEntreFechas(this.jDateFecha2.getDate(), niño.getFechaNac())>=20
            && modelo.calculoDiasEntreFechas(this.jDateFecha2.getDate(), niño.getFechaNac())<=23){
        niño.getCarne().getRecienNacido().setSegundoControl(jDateFecha2.getDate());
    }
    if((this.jDateFecha1.getDate() != null
            &&(modelo.calculoDiasEntreFechas(this.jDateFecha1.getDate(), niño.getFechaNac())<6
            || modelo.calculoDiasEntreFechas(this.jDateFecha1.getDate(), niño.getFechaNac())>9))
            || (this.jDateFecha1.getDate() != null
            &&(modelo.calculoDiasEntreFechas(this.jDateFecha2.getDate(), niño.getFechaNac())<20
            || modelo.calculoDiasEntreFechas(this.jDateFecha2.getDate(), niño.getFechaNac())>23))){
        JOptionPane.showMessageDialog(null,"Ingrese fechas correctas", "Error", 2);
    }
    
}//GEN-LAST:event_jBtnConfirmarActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBtnConfirmar;
    private javax.swing.JButton jBtnSalir;
    private com.toedter.calendar.JDateChooser jDateFecha1;
    private com.toedter.calendar.JDateChooser jDateFecha2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabelFecha1;
    private javax.swing.JLabel jLabelFecha2;
    private javax.swing.JLabel jLabelNombre;
    private javax.swing.JLabel jLabelTick1;
    private javax.swing.JLabel jLabelTick10;
    private javax.swing.JLabel jLabelTick11;
    private javax.swing.JLabel jLabelTick12;
    private javax.swing.JLabel jLabelTick13;
    private javax.swing.JLabel jLabelTick14;
    private javax.swing.JLabel jLabelTick15;
    private javax.swing.JLabel jLabelTick16;
    private javax.swing.JLabel jLabelTick17;
    private javax.swing.JLabel jLabelTick18;
    private javax.swing.JLabel jLabelTick19;
    private javax.swing.JLabel jLabelTick2;
    private javax.swing.JLabel jLabelTick20;
    private javax.swing.JLabel jLabelTick21;
    private javax.swing.JLabel jLabelTick22;
    private javax.swing.JLabel jLabelTick23;
    private javax.swing.JLabel jLabelTick24;
    private javax.swing.JLabel jLabelTick25;
    private javax.swing.JLabel jLabelTick26;
    private javax.swing.JLabel jLabelTick3;
    private javax.swing.JLabel jLabelTick4;
    private javax.swing.JLabel jLabelTick5;
    private javax.swing.JLabel jLabelTick6;
    private javax.swing.JLabel jLabelTick7;
    private javax.swing.JLabel jLabelTick8;
    private javax.swing.JLabel jLabelTick9;
    private javax.swing.JLabel jLabelTitular;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTextField jTMes1;
    private javax.swing.JTextField jTMes10;
    private javax.swing.JTextField jTMes11;
    private javax.swing.JTextField jTMes12;
    private javax.swing.JTextField jTMes2;
    private javax.swing.JTextField jTMes3;
    private javax.swing.JTextField jTMes4;
    private javax.swing.JTextField jTMes5;
    private javax.swing.JTextField jTMes6;
    private javax.swing.JTextField jTMes7;
    private javax.swing.JTextField jTMes8;
    private javax.swing.JTextField jTMes9;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField11;
    private javax.swing.JTextField jTextField12;
    private javax.swing.JTextField jTextField13;
    private javax.swing.JTextField jTextField14;
    private javax.swing.JTextField jTextField15;
    private javax.swing.JTextField jTextField16;
    private javax.swing.JTextField jTextField17;
    private javax.swing.JTextField jTextField18;
    private javax.swing.JTextField jTextField19;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField20;
    private javax.swing.JTextField jTextField21;
    private javax.swing.JTextField jTextField22;
    private javax.swing.JTextField jTextField23;
    private javax.swing.JTextField jTextField24;
    private javax.swing.JTextField jTextField25;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextField5;
    private javax.swing.JTextField jTextField6;
    private javax.swing.JTextField jTextField7;
    private javax.swing.JTextField jTextField8;
    // End of variables declaration//GEN-END:variables
}
